package com.xw.singleton;

/**
 * @author: xw
 * @create: 2022/9/14 10:23
 * @description: 枚举单例 线程安全 可以防止序列化和反序列化
 */
public enum Code04_EnumSingleton {
    INSTANCE;

    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            new Thread(()->
                System.out.println(Code04_EnumSingleton.INSTANCE.hashCode())
            ).start();
        }
    }
}
